package com.ruoyi.project.bajiaostar.cooperationDataManagement.domain;

import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.util.ObjectUtils;

import java.math.BigDecimal;

/**
 * 渠道分析管理对象 t_cooperation_data_management
 * 
 * @author 谢少辉
 * @date 2025-08-20
 */
@Data
public class CooperationDataManagement extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 加粉方案 */
    @Excel(name = "加粉方案")
    private String addPowderPlan;

    /** 开口率 */
    @Excel(name = "开口率")
    private BigDecimal openMouthRate;

    /** id删除率（0-100） */
    @Excel(name = "id删除率", readConverterExp = "0=-100")
    private BigDecimal idDelRate;

    /** 渠重率（0-100） */
    @Excel(name = "渠重率", readConverterExp = "0=-100")
    private BigDecimal channelRepetitionRate;

    /** 资源 */
    @Excel(name = "资源")
    private Long resource;

    /** 渠道类型 */
    @Excel(name = "渠道类型")
    private String channelType;

    /** 平台名称 */
    @Excel(name = "平台名称")
    private String platformName;

    /** $column.columnComment */
    private Long id;

    private  String testFlag;

    //资源折扣率
    private BigDecimal resourceRebateRate;

    //资源折算后
    private Long resourceRebateAfter;


    public void setResourceRebateRate(BigDecimal resourceRebateRate) {
        this.resourceRebateRate = resourceRebateRate;
        this.resourceRebateAfter =0L;
        if(!ObjectUtils.isEmpty(resourceRebateRate)){
            BigDecimal resourceRate = resourceRebateRate.divide(new BigDecimal(100));
            this.resourceRebateAfter =new BigDecimal(this.resource+"").multiply(resourceRate).longValue();
        }
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("addPowderPlan", getAddPowderPlan())
            .append("createTime", getCreateTime())
            .append("openMouthRate", getOpenMouthRate())
            .append("idDelRate", getIdDelRate())
            .append("channelRepetitionRate", getChannelRepetitionRate())
            .append("resource", getResource())
            .append("channelType", getChannelType())
            .append("platformName", getPlatformName())
            .append("id", getId())
            .toString();
    }
}
